﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

// std headers
#include <string>
#include <cstdint>
#include <memory>

// qt headers

// gcmp headers
#include "IFamilyLoadOptions.h"
#include "FamilyLoadOptionsDefaultImpl.h"

// custom headers
#include "GcsService.h"
#include "WorkFlowBase.h"


namespace gmepgcs
{
    struct GCS_SERVICE_EXPORTS ProjectComponentWorkflowArgument
    {
    public:
        explicit ProjectComponentWorkflowArgument() = default;
        explicit ProjectComponentWorkflowArgument(
            const std::wstring& projectId,
            const std::wstring& componentId,
            const int32_t componentVersion,
            const std::wstring& componentName
        ) :
            ProjectId(projectId),
            ComponentId(componentId),
            ComponentVersion(componentVersion),
            ComponentName(componentName) {};

        explicit ProjectComponentWorkflowArgument(
            const std::wstring& projectId,
            const std::wstring& componentId,
            const int32_t componentVersion,
            const std::wstring& componentName,
            const std::wstring& standardCode
        ) :
            ProjectId(projectId),
            ComponentId(componentId),
            ComponentVersion(componentVersion),
            ComponentName(componentName),
            ComponentCategoryStandardCode(standardCode) {};

        explicit ProjectComponentWorkflowArgument(
            const std::wstring& projectId,
            const std::wstring& componentId,
            int32_t componentVersion,
            const std::wstring& componentName,
            const std::wstring& familyTypeName,
            const std::wstring& standardCode
        ) :
            ProjectId(projectId),
            ComponentId(componentId),
            ComponentVersion(componentVersion),
            ComponentName(componentName),
            FamilyTypeName(familyTypeName),
            ComponentCategoryStandardCode(standardCode) {};

    public:
        std::wstring ProjectId = std::wstring();
        std::wstring ComponentId = std::wstring();
        int32_t ComponentVersion = -1;
        std::wstring ComponentName = std::wstring();
        std::wstring FamilyTypeName = std::wstring();
        std::wstring ComponentCategoryStandardCode;
    };

    class GCS_SERVICE_EXPORTS ProjectComponentWorkflowBase : public WorkflowBase
    {
        Q_OBJECT

    public:
        explicit ProjectComponentWorkflowBase(const ProjectComponentWorkflowArgument &argument, QObject *parent = nullptr);
        virtual ~ProjectComponentWorkflowBase();

    protected:
        const ProjectComponentWorkflowArgument& GetArgument() const;
        virtual bool ValidateArgument(std::wstring &message);

    private:
        ProjectComponentWorkflowArgument m_argument;
    };
    
}